﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.IO;
using System.Xml;
using System.Data;
using Gift.WebApp;
using Gift.Model;
using Gift.DAL;

public partial class cn_member_center_in_box : BasePage
{
    readonly DALInBox theInBox = new DALInBox();

    // Methods
    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.Session["user"] == null)
        {
            base.Response.Redirect("/cn/web_login.html?ru=" + HttpContext.Current.Request.Url.PathAndQuery.Replace("aspx", "html"));
        }
        if (!base.IsPostBack)
        {
            if ((base.Request.QueryString["id"] != null) && this.theInBox.Delete(Convert.ToInt32(base.Request.QueryString["id"])))
            {
                base.Response.Redirect("/cn/member_center/in_box.html");
            }
            this.rptInBoxBind();
        }
    }

    private void rptInBoxBind()
    {
        try
        {
            if (this.Session["user"] != null)
            {
                this.rptInBox.DataSource = this.theInBox.GetInBoxByAddressee((this.Session["user"] as tbUser).userName).DefaultView;
                this.rptInBox.DataBind();
            }
        }
        catch
        {
        }
    }

}